Chris Pollett > Old Classes >
CS157b

( Print View )

Student Corner:
  [Grades Sec1]
  [Grades Sec2]

  [Submit Sec1]
  [Submit Sec2]

  [Email List Sec1]
  [Email List Sec2]

  [
Lecture Notes]

Course Info:
  [Texts & Links]
  [Topics]
  [Grading]
  [HW Info]
  [Exam Info]
  [Regrades]
  [Honesty]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]

Practice Exams:
  [Mid1]  [Mid2]  [Final]

                           












CS157b Spring 2005Practice Midterm 2

To study for the midterm I would suggest you: (1) Know how to do (by heart) all the practice problems. (2) Go over your notes three times. Second and third time try to see how huch you can remember from the first time. (3) Go over the homework problems. (4) Try to create your own problems similar to the ones I have given and solve them. (5) Skim the relevant sections from the book. (6) If you want to study in groups, at this point you are ready to quiz each other. The practice midterm is below. Here are some facts about the actual midterm: (a) The midterm will be in class Apr 13. (b) It is closed book, closed notes. Nothing will be permitted on your desk except your pen (pencil) and test. (c) You should bring photo ID. (d) There will be more than one version of the test. Each version will be of comparable difficulty. (e) If your cell-phone or beeper goes off you will be excused from the test at that point and graded on what you have done till your excusal. (f) One problem (less typos) on the actual test will be from the practice test.

Student Generated Solutions-PDF.

1. Explain and give an example of how a range query might be carried out in a kd-tree.

2. Consider the following table:

R
A B
=====
1 a
1 b 
1 c
2 d
2 a
2 b
3 c
3 c
3 e

Show what a bitmap index on attribute A of R would look like. Show what a bitmap index on attribute B would look like.

3. Consider R={A,B,C,C} and S={C,A,A, B}. Compute their union as bags. Compute their cartesian product.

4. Compute the expression tree for the following SQL query: SELECT E.SALARY, E.SSN FROM EMPLOYEE E, PROJECT P WHERE E.pno=P.PNO AND P.name='HR';

5. Briefly explain what iterators are in the context of query evaluation. Give a one pass algorithm for duplicate elimination and say under what contexts it can be used.

6. Describe with an example how the two pass hash-join algorithm works.

7. Suppose we have two tables R(A,B) and S(B,C) where R has 1000 tuples and S has two thousand tuples. Suppose V(R,B) is 10 and V(S,B) is 30. Give an estimate of the number of tuples in (R join S).

8. What is a left deep join tree? What is branch and bound plan enumeration?

9. Give two example situations where a query optimizer is likely to choose a sort merge join.

10. What is the rule for pushing a projection past a join in a query tree?